class Veiculo < ActiveRecord::Base
    has_one :dutdetran 
    has_one :ipem 
    has_one :homologacao
    belongs_to :motorista
    validates_presence_of(:viatura,:placa,:combustivel,:marca,:ano_fabricacao,:ano_modelo,:cor_predominante,:modelo,:especie,:motorista_id)

    attr_accessor :created_at,:updated_at
  
    def format_date(date)  
      (date.nil?) ? nil : date.strftime('%d/%m/%Y')
    end

    def created_at_s     
      format_date(self.created_at)
    end 
    def updated_at_s     
      format_date(self.updated_at)
    end 
end
